/*
 *  levelUpGame - CollisionHandler.h
 *  Copyright 2011 W. Reckman. All rights reserved.
 */
#ifndef COLLISION_HANDLER_H
#define COLLISION_HANDLER_H

#include "ofEvents.h"
#include "Ghost.h"
#include "Pickup.h"
#include "Player.h"

class Settings;
class GameModel;
class LevelUpApp;


//--------------------------------------------------------------
class EventArgsCollision {
public:
	enum COLLISION_OBJECT_TYPE { COT_PLAYER, COT_GHOST, COT_PICKUP };
	
	union CollisionObject {
		Ghost* ghost;
		Pickup* pickup;
		Player* player;
	};
	
	
	enum COLLISION_OBJECT_TYPE co1Type;
	enum COLLISION_OBJECT_TYPE co2Type;
	
	CollisionObject o1;
	CollisionObject o2;
};


//--------------------------------------------------------------
class CollisionHandler {
public:
	explicit CollisionHandler( LevelUpApp& appRef_ );
	void setup();
	
	void onCollisionDetected( EventArgsCollision& ev_ );
	
private:
	LevelUpApp& appRef;
	GameModel& game;
	Settings& s;
	
	float playerFreezeTime;
	
	void handlePlayerPlayerCollision( Player* p1, Player* p2 );
	void handlePlayerPickupCollision( Player* player, Pickup* pickup );
	void handlePlayerGhostCollision( Player* player, Ghost* ghost );
	
	void logCollisionEvent( EventArgsCollision& ev_ );
};

#endif /* ! COLLISION_HANDLER_H */
